home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
program
/
slix0987.zip
/
GMUTILS.ZIP
/
BINTOC.DOC
< prev
next >
Wrap
Text File
|
1995-06-22
|
3KB
|
73 lines
BINTOC - Binary To C -converter
Documentation
by Petri Hassinen
Contact via Internet:
phassine@alpha.hut.fi
PURPOSE
BINTOC is a utility for converting binary files into an ASCII form
that can be directly linked into your executables with the help of a
C compiler. BINTOC also supports the inclusion of multiple source
files into the same target file.
OPERATION
BINTOC reads a portion of a binary file into one of its memory
buffers. Then the data is formulated into C and written to a target
file. In this way, BINTOC can deal with files of any sizes.
Care must be taken when a variable name is specified for your data
since no syntactic checking takes place. You can easily specify
names that are not recognized by C compilers. However, should you
specify an incorrect name inadvertently you can always regenerate
the file or edit it with a text editor to fix your mistake.
BINTOC recognizes only two separate switches. One tells the program
to overwrite the previously existing file without warning and the
other is used to append the files into the same target file.
The target file that BINTOC creates is 5 times the size of the
original size.
For more information, type "BINTOC /?" at the DOS prompt.
EXAMPLES
Suppose that you have a picture that you want to link into your
program. By doing so you increase the size of your program but also
effectively hide the actual data from curious rippers. In addition,
you do not have to load the picture file explicitly from a disk. So,
this is what you do:
Picture file: MYPIC.RAW
Program file: MYPROG.C
1. Convert your picture into C by writing:
BINTOC mypic.raw mypic.c mypic[]
If you want to add e.g. another picture into the same file (mypic.c)
you can write:
BINTOC mypic2.raw mypic.c mypic2[] /A
The data is thus appended to the previously existing file. If you
use this switch and the previous file does not exist, it is created.
2. After the conversion, add the following line to the beginning of
your program file:
extern unsigned char mypic[];
3. Add the file mypic.c to your project or makefile.
4. Write the code to process the picture by reading it from the
array mypic[].
5. Compile and link your program and voilá, you have done it!
IN CONCLUSION
The source code for BINTOC (both DOS and UNIX versions) is available
to all interested parties. Just contact me and I'll send it to you
via email.
EOF